import requests
import json
# API接口，返回格式为json
api_url = "http://www.zdopen.com/ShortProxy/GetIP/?api=202408111541261774&akey=7028bb06d706d5a1&timespan=5&type=3"

# API接口返回的ip
proxy_ip = requests.get(api_url).json()['data']['proxy_list']

# str_demo1 = '{"code":"10001","msg":"获取成功","data":{"count":5,"proxy_list":[{"ip":"27.158.47.142","port":48393},{"ip":"183.143.248.188","port":37528},{"ip":"171.9.108.52","port":56598},{"ip":"117.29.73.127","port":59457},{"ip":"121.206.62.44","port":37688}]}}'
# json_str= json.loads(str_demo1)['data']['proxy_list']

ip_group= []
for ip in proxy_ip:
    new_ip = '"http://'+str(ip.get('ip'))+':'+str(ip.get('port'))+'"'
    ip_group.append(new_ip)

print(",\n".join(ip_group))